From: Andres Lagar-Cavilla Date: Tue, 6 Dec 2011 20:10:32 +0000 (+0000) Subject: x86/mm: Flag mem_events caused by foreign domains X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=a85f0caca62f4909c92927f1fd671bb0cce273f2;p=xen.git x86/mm: Flag mem_events caused by foreign domains Add a new flag for mem events, as consumers might need to discriminate foreign domain-caused from guest-caused events. The vcpu field of an event is bogus from a consumer p.o.v. for foreign domain-caused events. Also assert that we shouldn't be pausing foreign vcpus. Signed-off-by: Andres Lagar-Cavilla Acked-by: Tim Deegan Committed-by: Tim Deegan --- diff --git a/xen/arch/x86/mm/mem_event.c b/xen/arch/x86/mm/mem_event.c index d484f1f50d..17b8471c46 100644 --- a/xen/arch/x86/mm/mem_event.c +++ b/xen/arch/x86/mm/mem_event.c @@ -143,6 +143,12 @@ void mem_event_put_request(struct domain *d, struct mem_event_domain *med, mem_e front_ring = &med->front_ring; req_prod = front_ring->req_prod_pvt; + if ( current->domain != d ) + { + req->flags |= MEM_EVENT_FLAG_FOREIGN; + ASSERT( !(req->flags & MEM_EVENT_FLAG_VCPU_PAUSED) ); + } + /* Copy request */ memcpy(RING_GET_REQUEST(front_ring, req_prod), req, sizeof(*req)); req_prod++; diff --git a/xen/include/public/mem_event.h b/xen/include/public/mem_event.h index 0097b34a33..0b91a76341 100644 --- a/xen/include/public/mem_event.h +++ b/xen/include/public/mem_event.h @@ -39,6 +39,7 @@ #define MEM_EVENT_FLAG_VCPU_PAUSED (1 << 0) #define MEM_EVENT_FLAG_DROP_PAGE (1 << 1) #define MEM_EVENT_FLAG_EVICT_FAIL (1 << 2) +#define MEM_EVENT_FLAG_FOREIGN (1 << 3) /* Reasons for the memory event request */ #define MEM_EVENT_REASON_UNKNOWN 0 /* typical reason */